$(document).ready(function(){
	amazfit.bindHuami();
});
var userId = $amazfit.comm.getUrlParam("state")||"14lV0nUQyl8c69sEdgpN";
var code = $amazfit.comm.getUrlParam("code")||"D6jkxlvwdKYOelscfzAkag1v10yzp0AL";
var amazfit = {
	baseUrl:{
		bindHuamiAccessToken:$amazfit.config.basePath+"webapi/service/bindHuamiAccessToken",//华米授权绑定
	}
}
/******华米授权绑定**********/
amazfit.bindHuami = function(){
	var params = {
    	data:{
    		code:code,//实际用量
    		userId:userId,//饮食情况ID
    	}
    }
    $amazfit.load();
    $amazfit.comm.post({
        url : amazfit.baseUrl.bindHuamiAccessToken,
        data:JSON.stringify(params),
        success : function(success,data) {
        	if(data.success){
        		$(".success.uhide").removeClass("uhide");
        	}else{
        		$(".fail .container .reason").text(data.msg);
        		$(".fail.uhide").removeClass("uhide");
        	}
        	$amazfit.closeLoad();
        },
        error : function(state, message) {
        	$amazfit.closeLoad();
        }
    });
}